package com.bw.zhuangao5___day002.Fragment.Home.Fragment3;

import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import com.bw.mvp.V.BannerFragment;
import com.bw.zhuangao5___day002.R;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;

import java.util.List;


public class BlankFragmentHome3 extends BannerFragment implements ClassContion.resview {

    int shang =0;
    private SmartRefreshLayout classSmar;
    private RecyclerView classReview;
    public boolean isclass=true;
    int pash =2;
    ClassPretenter classPretenter;
    ClassBaseAdpter classBaseAdpter;


    @Override
    public int bandLayoud() {
        return R.layout.fragment_blank_fragment_home3;
    }

    @Override
    public void initView() {


        classReview = (RecyclerView) findViewById(R.id.class_review);

        classReview.setLayoutManager(new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL));
        classPretenter = new ClassPretenter(this,new ClassModel());
        classPretenter.yangwangye();
    }

    @Override
    public void initDate() {

    }

    @Override
    public void getresview(List<JavaClass.ResultBean.DataBean> verticalBeans) {

        for (JavaClass.ResultBean.DataBean  haonide:verticalBeans) {
            haonide.setHaasstaty(++shang);
            if (shang==3)
            {
                shang=0;
            }
        }
        if (classBaseAdpter==null)
        {
            classBaseAdpter = new ClassBaseAdpter(verticalBeans);
            classReview.setAdapter(classBaseAdpter);
        }else {
            if (isclass)
            {
                classBaseAdpter.getData().clear();
            }
            classBaseAdpter.getData().addAll(verticalBeans);
            classBaseAdpter.notifyDataSetChanged();
        }
    }





}
